﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Simple.Services;
using Simple.Services.System.QHSEViolationCategory.Models;

namespace Simple.WebApi.Controllers.System;

/// <summary>
/// 违章人员信息
/// </summary>
[Route("QHSEViolationUser/[action]")]
[ApiController]
public class QHSEViolationUserController : ControllerBase
{
    private readonly QHSEViolationUserService _violationUserService;

    public QHSEViolationUserController(QHSEViolationUserService violationUserService)
    {
        _violationUserService = violationUserService;
    }
    /// <summary>
    /// 违章人员列表
    /// </summary>
    [HttpGet]
    [CustomAuthorize("hdv_qhse_data")]
    public async Task<AppResult> List()
    {
        var menus = await _violationUserService.GetAsync();
        return AppResult.Status200OK(data: menus);
    }
    /// <summary>
    /// 违章人员查询
    /// </summary>
    [HttpPost]
    [CustomAuthorize("hdv_qhse_data")]
    public async Task<AppResult> ClausResult([FromBody] IdInputModel idInput)
    {
        var data = await _violationUserService.GetById(idInput);
        return AppResult.Status200OK(data: data);
    }
}
